package com.lujieni.springboothutool.controller;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.lujieni.springboothutool.po.PersonPO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JsonController {

    @GetMapping(value = "/show")
    public PersonPO show(){
        PersonPO personPO = new PersonPO();
        personPO.setAge(34);
        // 默认忽略null值
        System.out.println(JSONUtil.toJsonStr(personPO));
        // 不忽略null值  11222
        System.out.println(JSONUtil.parseObj(personPO, false));
        return personPO;
    }


}
